//package com.itcast.activiti.listener;
//
//import com.alibaba.fastjson.JSONObject;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
//import org.apache.rocketmq.common.consumer.ConsumeFromWhere;
//import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
//import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
//import org.apache.rocketmq.spring.core.RocketMQListener;
//import org.apache.rocketmq.spring.core.RocketMQPushConsumerLifecycleListener;
//import org.springframework.stereotype.Component;
//
///**
// * 任务驳回
// * 务状态：start：开始任务）take：任务审批）end：任务结束）
// */
//@Slf4j
//@Component
//@RocketMQMessageListener(
//        topic = "${activiti.rocketmq.topic.activiti}",
//        consumerGroup = "${activiti.rocketmq.consumer.group.task_apply}",
//        selectorExpression = "TAG_ACTIVITI_TASK_REJECT")
//public class TaskApplyQueueListener implements RocketMQListener<JSONObject>, RocketMQPushConsumerLifecycleListener {
//    private final String EVENTNAME_END = "end";
//    private final String EVENTNAME_TAKE = "take";
//
//    @Override
//    public void onMessage(JSONObject message) {
//        log.info("task pass RocketMQMessageListener {}", message);
//
//        //        {
////            "passbackParam": "业务方回传参数 推荐JSON",
////                "businessKey": "业务key",
////                "assignee": "代理人",
////                "event": "任务状态：start：开始任务）take：任务审批）end：任务结束）",
////                "taskRequestParam": {
////                    "audit": true, // 审批通过
////                    "comment": "意见",
////                    "variables": {
////                          "variables1": "变量"
////                      }
////        },
////            "taskId": "任务id"
////        }
//        if (EVENTNAME_TAKE.equals(message.getString("event"))) {
//            // 任务审批进行中
//        } else if (EVENTNAME_END.equals(message.getString("event"))) {
//            // 任务审批结束
//        }
//    }
//
//    @Override
//    public void prepareStart(DefaultMQPushConsumer defaultMQPushConsumer) {
//        defaultMQPushConsumer.setConsumeTimeout(1);
//        defaultMQPushConsumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET);
//        defaultMQPushConsumer.setMaxReconsumeTimes(3);
//        defaultMQPushConsumer.setMessageModel(MessageModel.BROADCASTING);
//    }
//}